<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="js/jquery-3.6.0.js"></script>
</head>
<body>

<h1 align="center">电影信息列表</h1>
<div style="margin-left: 385px">
    <input type="button" onclick="location.href='movieAdd.jsp'" value="添加电影">
</div>
    <table align="center" border="1px">
        <tr>
            <td>电影名称</td>
            <td>电影类型</td>
            <td>价格</td>
            <td>是否推荐</td>
            <td>上映时间</td>
            <td>下映时间</td>
            <td>投票数</td>
        </tr>
        <c:forEach items="${list}" var="movie">
            <tr>
                <td>${movie.movieName}</td>
                <td>${movie.movieType}</td>
                <td>${movie.price}</td>
                <td>${movie.recommend==1?"推荐":"不推荐"}</td>
                <td>${movie.startTime}</td>
                <td>${movie.endTime}</td>
                <td>${movie.votes}</td>
            </tr>
        </c:forEach>
    </table>

<div align="center">
    <a href="MovieLimitServlet?pageNo=1">首页</a>
    <c:if test="${sessionScope.pageNo==1}">
        <a href="#">上一页</a>
    </c:if>
    <c:if test="${sessionScope.pageNo>1}">
        <a href="MovieLimitServlet?pageNo=${sessionScope.pageNo-1}">上一页</a>
    </c:if>
    <c:if test="${sessionScope.pageNo<sessionScope.pageZym}">
        <a href="MovieLimitServlet?pageNo=${sessionScope.pageNo+1}">下一页</a>
    </c:if>
    <c:if test="${sessionScope.pageNo>=sessionScope.pageZym}">
        <a href="#">下一页</a>
    </c:if>
    <a href="MovieLimitServlet?pageNo=${sessionScope.pageZym}">尾页</a>
    第${sessionScope.pageNo},共${sessionScope.pageZym},总记录数${sessionScope.count}条
</div>
</body>
</html>
